package com.huawei.appgallery.forum.message.activity;

import android.app.ActionBar;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.forum.base.ui.ForumActivity;
import com.huawei.appgallery.forum.message.api.IMessageDetailProtocol;
import com.huawei.appgallery.forum.message.fragment.IMessageDetailFrgProtocol;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.hmf.annotation.ActivityDefine;
import java.lang.ref.WeakReference;
import o.bsm;
import o.bvj.a;
import o.bvj.e;
import o.AccountBussinessListener;
import o.ccp;
import o.cgv;
import o.eod;
import o.eoj;
import o.evx;
import o.fho;
import o.fiu;
import o.fiv;
import o.fjb;
import o.fjm;
import o.FragmentTransaction;

@ActivityDefine(alias = "message_detail_activity", protocol = IMessageDetailProtocol.class)
public class MessageDetailActivity extends ForumActivity implements bsm {
    private fiv ˋॱ = fiv.ॱ(this);
    private TextView ͺ;

    static class d implements AccountBussinessListener {
        private WeakReference<MessageDetailActivity> ˊ;
        private Bundle ˏ;

        public d(MessageDetailActivity messageDetailActivity, Bundle bundle) {
            this.ˊ = new WeakReference(messageDetailActivity);
            this.ˏ = bundle;
        }

        public void onAccountBusinessResult(ccp o_ccp) {
            eoj.ˋ().ˊ("MessageDetailActivity");
            MessageDetailActivity messageDetailActivity = (MessageDetailActivity) this.ˊ.get();
            if (messageDetailActivity == null) {
                return;
            }
            if (UserSession.getInstance().isLoginSuccessful()) {
                messageDetailActivity.ˏ(this.ˏ);
            } else {
                messageDetailActivity.finish();
            }
        }
    }

    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        setContentView(e.ॱ);
        getWindow().getDecorView().setBackgroundColor(getResources().getColor(a.ᐝ));
        cgv.ˋ(this, a.ॱ, a.ᐝ);
        ᐝ();
        if (UserSession.getInstance().isLoginSuccessful()) {
            ˏ(bundle);
            return;
        }
        eoj.ˋ().ˎ("MessageDetailActivity", new d(this, bundle));
        eod.ॱ((Context) this);
    }

    private void ˏ(Bundle bundle) {
        ˎ(bundle);
    }

    private void ˎ(Bundle bundle) {
        IMessageDetailProtocol iMessageDetailProtocol = (IMessageDetailProtocol) this.ˋॱ.ॱ();
        if (iMessageDetailProtocol != null) {
            int type = iMessageDetailProtocol.getType();
            String uri = iMessageDetailProtocol.getUri();
            String domainId = iMessageDetailProtocol.getDomainId();
            if (bundle == null) {
                fjb ˎ = fho.ˏ().ˋ("Message").ˎ("message.detail");
                IMessageDetailFrgProtocol iMessageDetailFrgProtocol = (IMessageDetailFrgProtocol) ˎ.ˊ();
                iMessageDetailFrgProtocol.setUri(uri);
                iMessageDetailFrgProtocol.setDetailType(type);
                iMessageDetailFrgProtocol.setDomainId(domainId);
                fjm ˏ = fjm.ˏ(fiu.ˊ().ˋ(this, ˎ));
                FragmentTransaction ˊ = ˏॱ().ˊ();
                ˊ.ˋ(b.ᐧ, ˏ.ˏ());
                ˊ.ˋ();
            }
        }
    }

    private void ᐝ() {
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        View findViewById = findViewById(b.ʹ);
        ˏ(findViewById);
        this.ͺ = (TextView) findViewById.findViewById(b.ˈॱ);
    }

    private void ˏ(View view) {
        view.findViewById(b.ˏˏ).setOnClickListener(new evx(this) {
            final /* synthetic */ MessageDetailActivity ॱ;

            {
                this.ॱ = r1;
            }

            public void ˋ(View view) {
                this.ॱ.onBackPressed();
            }
        });
    }

    public void ˏ(String str) {
        this.ͺ.setText(str);
    }
}
